/* Canvas.h
Michael Zahniser, 06/10/09

Header file for the Canvas class, which wraps a surface and provides functions
for drawing lines on that surface. Optionally, the canvas can be created in a
mathematical coordinate system (origin in the lower left) instead of in typical
screen coordinates (origin in the upper left).

NOTE: A Canvas locks the pixels of a Surface for as long as the canvas exists.
This means that you should create a new Canvas each time you want to draw.
*/

#ifndef __MZ_CANVAS_H__
#define __MZ_CANVAS_H__

#include "Surface.h"
#include "PixMap.h"



class Canvas {
public:
	Canvas(Surface &surface, bool invertY = false);
	
	void SetPenColor(Uint32 color);
	void SetPenColor(int red, int green, int blue);
	void SetPenColor(int greyLevel);
	
	void MoveTo(int x, int y);
	void LineTo(int x, int y);
	
	
private:
	// This holds a lock on the surface so that it is safe to edit the pixels.
	PixMap pixels;
	// The begin and pitch will be set differently depending on whether the
	// coordinate system is inverted or not.
	Uint32 *begin;
	int pitch;
	
	// Pen color.
	Uint32 penColor;
	// Current pen position.
	int penX;
	int penY;
};

#endif

